home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / WarpQuake / Src / glquake.h < prev    next >
C/C++ Source or Header  |  2000-05-22  |  7KB  |  252 lines

  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3.  
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License
  6. as published by the Free Software Foundation; either version 2
  7. of the License, or (at your option) any later version.
  8.  
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  12.  
  13. See the GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18.  
  19. */
  20. // disable data conversion warnings
  21.  
  22. #pragma warning(disable : 4244)     // MIPS
  23. #pragma warning(disable : 4136)     // X86
  24. #pragma warning(disable : 4051)     // ALPHA
  25.   
  26. #ifdef _WIN32
  27. #include <windows.h>
  28. #endif
  29.  
  30. #include <GL/gl.h>
  31. #include <GL/glu.h>
  32.  
  33. void GL_BeginRendering (int *x, int *y, int *width, int *height);
  34. void GL_EndRendering (void);
  35.  
  36.  
  37. #ifdef _WIN32
  38. // Function prototypes for the Texture Object Extension routines
  39. typedef GLboolean (APIENTRY *ARETEXRESFUNCPTR)(GLsizei, const GLuint *,
  40.                     const GLboolean *);
  41. typedef void (APIENTRY *BINDTEXFUNCPTR)(GLenum, GLuint);
  42. typedef void (APIENTRY *DELTEXFUNCPTR)(GLsizei, const GLuint *);
  43. typedef void (APIENTRY *GENTEXFUNCPTR)(GLsizei, GLuint *);
  44. typedef GLboolean (APIENTRY *ISTEXFUNCPTR)(GLuint);
  45. typedef void (APIENTRY *PRIORTEXFUNCPTR)(GLsizei, const GLuint *,
  46.                     const GLclampf *);
  47. typedef void (APIENTRY *TEXSUBIMAGEPTR)(int, int, int, int, int, int, int, int, void *);
  48.  
  49. extern    BINDTEXFUNCPTR bindTexFunc;
  50. extern    DELTEXFUNCPTR delTexFunc;
  51. extern    TEXSUBIMAGEPTR TexSubImage2DFunc;
  52. #endif
  53.  
  54. extern    int texture_extension_number;
  55. extern    int        texture_mode;
  56.  
  57. extern    float    gldepthmin, gldepthmax;
  58.  
  59. void GL_Upload32 (unsigned *data, int width, int height,  qboolean mipmap, qboolean alpha);
  60. void GL_Upload8 (byte *data, int width, int height,  qboolean mipmap, qboolean alpha);
  61. int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha);
  62. int GL_FindTexture (char *identifier);
  63.  
  64. typedef struct
  65. {
  66.     float    x, y, z;
  67.     float    s, t;
  68.     float    r, g, b;
  69. } glvert_t;
  70.  
  71. extern glvert_t glv;
  72.  
  73. extern    int glx, gly, glwidth, glheight;
  74.  
  75. #ifdef _WIN32
  76. extern    PROC glArrayElementEXT;
  77. extern    PROC glColorPointerEXT;
  78. extern    PROC glTexturePointerEXT;
  79. extern    PROC glVertexPointerEXT;
  80. #endif
  81.  
  82. // r_local.h -- private refresh defs
  83.  
  84. #define ALIAS_BASE_SIZE_RATIO        (1.0 / 11.0)
  85.                     // normalizing factor so player model works out to about
  86.                     //  1 pixel per triangle
  87. #define    MAX_LBM_HEIGHT        480
  88.  
  89. #define TILE_SIZE        128        // size of textures generated by R_GenTiledSurf
  90.  
  91. #define SKYSHIFT        7
  92. #define    SKYSIZE            (1 << SKYSHIFT)
  93. #define SKYMASK            (SKYSIZE - 1)
  94.  
  95. #define BACKFACE_EPSILON    0.01
  96.  
  97.  
  98. void R_TimeRefresh_f (void);
  99. void R_ReadPointFile_f (void);
  100. texture_t *R_TextureAnimation (texture_t *base);
  101.  
  102. typedef struct surfcache_s
  103. {
  104.     struct surfcache_s    *next;
  105.     struct surfcache_s     **owner;        // NULL is an empty chunk of memory
  106.     int                    lightadj[MAXLIGHTMAPS]; // checked for strobe flush
  107.     int                    dlight;
  108.     int                    size;        // including header
  109.     unsigned            width;
  110.     unsigned            height;        // DEBUG only needed for debug
  111.     float                mipscale;
  112.     struct texture_s    *texture;    // checked for animating textures
  113.     byte                data[4];    // width*height elements
  114. } surfcache_t;
  115.  
  116.  
  117. typedef struct
  118. {
  119.     pixel_t        *surfdat;    // destination for generated surface
  120.     int            rowbytes;    // destination logical width in bytes
  121.     msurface_t    *surf;        // description for surface to generate
  122.     fixed8_t    lightadj[MAXLIGHTMAPS];
  123.                             // adjust for lightmap levels for dynamic lighting
  124.     texture_t    *texture;    // corrected for animating textures
  125.     int            surfmip;    // mipmapped ratio of surface texels / world pixels
  126.     int            surfwidth;    // in mipmapped texels
  127.     int            surfheight;    // in mipmapped texels
  128. } drawsurf_t;
  129.  
  130.  
  131. typedef enum {
  132.     pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2
  133. } ptype_t;
  134.  
  135. // !!! if this is changed, it must be changed in d_ifacea.h too !!!
  136. typedef struct particle_s
  137. {
  138. // driver-usable fields
  139.     vec3_t        org;
  140.     float        color;
  141. // drivers never touch the following fields
  142.     struct particle_s    *next;
  143.     vec3_t        vel;
  144.     float        ramp;
  145.     float        die;
  146.     ptype_t        type;
  147. } particle_t;
  148.  
  149.  
  150. //====================================================
  151.  
  152.  
  153. extern    entity_t    r_worldentity;
  154. extern    qboolean    r_cache_thrash;        // compatability
  155. extern    vec3_t        modelorg, r_entorigin;
  156. extern    entity_t    *currententity;
  157. extern    int            r_visframecount;    // ??? what difs?
  158. extern    int            r_framecount;
  159. extern    mplane_t    frustum[4];
  160. extern    int        c_brush_polys, c_alias_polys;
  161.  
  162.  
  163. //
  164. // view origin
  165. //
  166. extern    vec3_t    vup;
  167. extern    vec3_t    vpn;
  168. extern    vec3_t    vright;
  169. extern    vec3_t    r_origin;
  170.  
  171. //
  172. // screen size info
  173. //
  174. extern    refdef_t    r_refdef;
  175. extern    mleaf_t        *r_viewleaf, *r_oldviewleaf;
  176. extern    texture_t    *r_notexture_mip;
  177. extern    int        d_lightstylevalue[256];    // 8.8 fraction of base light value
  178.  
  179. extern    qboolean    envmap;
  180. extern    int    currenttexture;
  181. extern    int    cnttextures[2];
  182. extern    int    particletexture;
  183. extern    int    playertextures;
  184.  
  185. extern    int    skytexturenum;        // index in cl.loadmodel, not gl texture object
  186.  
  187. extern    cvar_t    r_norefresh;
  188. extern    cvar_t    r_drawentities;
  189. extern    cvar_t    r_drawworld;
  190. extern    cvar_t    r_drawviewmodel;
  191. extern    cvar_t    r_speeds;
  192. extern    cvar_t    r_waterwarp;
  193. extern    cvar_t    r_fullbright;
  194. extern    cvar_t    r_lightmap;
  195. extern    cvar_t    r_shadows;
  196. extern    cvar_t    r_mirroralpha;
  197. extern    cvar_t    r_wateralpha;
  198. extern    cvar_t    r_dynamic;
  199. extern    cvar_t    r_novis;
  200.  
  201. extern    cvar_t    gl_clear;
  202. extern    cvar_t    gl_cull;
  203. extern    cvar_t    gl_poly;
  204. extern    cvar_t    gl_texsort;
  205. extern    cvar_t    gl_smoothmodels;
  206. extern    cvar_t    gl_affinemodels;
  207. extern    cvar_t    gl_polyblend;
  208. extern    cvar_t    gl_keeptjunctions;
  209. extern    cvar_t    gl_reporttjunctions;
  210. extern    cvar_t    gl_flashblend;
  211. extern    cvar_t    gl_nocolors;
  212. extern    cvar_t    gl_doubleeyes;
  213.  
  214. extern    int        gl_lightmap_format;
  215. extern    int        gl_solid_format;
  216. extern    int        gl_alpha_format;
  217.  
  218. extern    cvar_t    gl_max_size;
  219. extern    cvar_t    gl_playermip;
  220.  
  221. extern    int            mirrortexturenum;    // quake texturenum, not gltexturenum
  222. extern    qboolean    mirror;
  223. extern    mplane_t    *mirror_plane;
  224.  
  225. extern    float    r_world_matrix[16];
  226.  
  227. extern    const char *gl_vendor;
  228. extern    const char *gl_renderer;
  229. extern    const char *gl_version;
  230. extern    const char *gl_extensions;
  231.  
  232. void R_TranslatePlayerSkin (int playernum);
  233. void GL_Bind (int texnum);
  234.  
  235. // Multitexture
  236. #define    TEXTURE0_SGIS                0x835E
  237. #define    TEXTURE1_SGIS                0x835F
  238.  
  239. #ifndef _WIN32
  240. #define APIENTRY /* */
  241. #endif
  242.  
  243. typedef void (APIENTRY *lpMTexFUNC) (GLenum, GLfloat, GLfloat);
  244. typedef void (APIENTRY *lpSelTexFUNC) (GLenum);
  245. extern lpMTexFUNC qglMTexCoord2fSGIS;
  246. extern lpSelTexFUNC qglSelectTextureSGIS;
  247.  
  248. extern qboolean gl_mtexable;
  249.  
  250. void GL_DisableMultitexture(void);
  251. void GL_EnableMultitexture(void);
  252.